function ajax({
    method='get',
    url = "",
    header,
    parmars = "",
    data
  }){
    xhr.open(method,`http://localhost:8888${url}${parmars}`,true);
    Object.entries(header)
    .forEach(([key,value])=>{
        xhr.setRequestHeader(key,value);
    })


    const bodyData = Object.entries(data);
    if (bodyData.length === 0) {
        xhr.send();
    } else {
        const bodyParams = new URLSearchParams();
        bodyData.forEach(([key, val]) => bodyParams.append(key, val));
        xhr.send(bodyParams.toString());
    }

    xhr.onload = function() {
        console.log(xhr.response);
    }
  }  